<div class="panel-heading" ng-click="show = !show">
	<h4 class="panel-title">
		<a href>
			<span class="glyphicon" ng-class="{'glyphicon-exclamation-sign': state.last.Status && state.last.Status != 'normal'}"></span>
			<span class="glyphicon" ng-class="{'glyphicon-volume-off': child.Silenced}"></span>
			<span class="glyphicon" ng-class="{'glyphicon-question-sign': state.Unevaluated}"></span>
			<span ng-show="state.last.IncidentId">#{{state.last.IncidentId}}:</span>
			<span ng-bind="child.Subject || child.AlertKey"></span>
			
			<span class="pull-right" ng-show="child.Ago" ts-since="child.Ago"></span>
		</a>
	</h4>
</div>
<div class="panel-body" ng-if="show || group.Children.length == 1">
	<div class="row">
		<div class="col-sm-6">
			<div class="row">
				<div class="col-sm-3">
					<p><strong>Alert Key:</strong></p>
				</div>
				<div class="col-sm-9">
					<span ng-bind="zws(name)" />
				</div>
			</div>
			<div class="row">
				<div class="col-sm-3">
					<p><strong>State:</strong></p>
				</div>
				<div class="col-sm-9">
					<span ng-bind="state.last.Status" /> since <span ts-time="state.last.Time"/>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-3">
					<p><strong>Views:</strong></p>
				</div>
				<div class="col-sm-9">
					<a ng-href="/history?key={{encode(name)}}">Full History</a>,
					<a ng-href="{{state.RuleUrl}}">Rule Editor</a>,
					<a ng-href="/expr?expr={{btoa(state.Expr)}}">Expression</a>,
					<a ng-href="/incident?id={{state.last.IncidentId}}">Incident (#<span ng-bind="state.last.IncidentId"/>)</a>
				</div>
			</div>
		</div>
		<div class="col-sm-6">
			<div class="row">
				<div class="col-sm-3">
					<p><strong>Silence:</strong></p>
				</div>
				<div class="col-sm-9">
					<a class="btn btn-default btn-xs" ng-href="/silence?duration=1h&alert={{state.Alert}}&tags={{encode(state.Tags)}}">1 hour</a>
					<a class="btn btn-default btn-xs" ng-href="/silence?duration=2h&alert={{state.Alert}}&tags={{encode(state.Tags)}}">2 hours</a>
					<a class="btn btn-default btn-xs" ng-href="/silence?duration=6h&alert={{state.Alert}}&tags={{encode(state.Tags)}}">6 hours</a>
					<a class="btn btn-default btn-xs" ng-href="/silence?duration=12h&alert={{state.Alert}}&tags={{encode(state.Tags)}}">12 hours</a>
					<a class="btn btn-default btn-xs" ng-href="/silence?duration=24h&alert={{state.Alert}}&tags={{encode(state.Tags)}}">24 hours</a>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-3">
					<p><strong>Actions:</strong></p>
				</div>
				<div class="col-sm-9">
					<ts-ack></ts-ack>
					<ts-close></ts-close>
					<ts-forget ng-if="group.Status == 'unknown'"></ts-forget>
				</div>
			</div>
			<div class="row" ng-show="state.LastAction">
				<div class="col-sm-3">
					<p><strong>Last Action:</strong></p>
				</div>
				<div class="col-sm-9">
					{{state.LastAction.Type}}
					<span ng-show="state.LastAction.User">by {{state.LastAction.User}}</span>
					at <span ts-time="state.LastAction.Time"></span>
					<span ng-show="state.LastAction.Message">: {{state.LastAction.Message}}</span>
				</div>
			</div>
		</div>
	</div>
	<div class="row" ng-if="state.Body">
		<div class="col-sm-12">
			<hr/>
		</div>
		<div class="col-sm-12" ng-bind-html="state.Body"></div>
	</div>
</div>
